<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tinyOS: tTimer.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">tinyOS
   &#160;<span id="projectnumber">v1.00</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('t_timer_8c_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">tTimer.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="t_timer_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="t_timer_8h.html">tTimer.h</a>&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="tiny_o_s_8h.html">tinyOS.h</a>&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#if !defined(TINYOS_ENABLE_TIMER) || TINYOS_ENABLE_TIMER == 1</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">static</span> <a class="code" href="struct__t_list.html">tList</a> tTimerHardList;                    <span class="comment">// &quot;硬&quot;定时器列表</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">static</span> <a class="code" href="struct__t_list.html">tList</a> tTimerSoftList;                    <span class="comment">// &quot;软&quot;定时器列表</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">static</span> <a class="code" href="struct__t_sem.html">tSem</a> tTimerProtectSem;                   <span class="comment">// 用于访问软定时器列表的信号量</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="keyword">static</span> <a class="code" href="struct__t_sem.html">tSem</a> tTimerTickSem;                      <span class="comment">// 用于软定时器任务与中断同步的计数信号量</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga2a6a895916b16bcb9b01ac53cb28e015">   34</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga2a6a895916b16bcb9b01ac53cb28e015">tTimerInit</a> (<a class="code" href="struct__t_timer.html">tTimer</a> *timer, uint32_t delayTicks, uint32_t durationTicks,</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                 <span class="keywordtype">void</span> (*timerFunc) (<span class="keywordtype">void</span> *arg), <span class="keywordtype">void</span> *arg, uint32_t config) {</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#gae1557d8978ed3d8374e2ab3f0920c860">tNodeInit</a>(&amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a> = delayTicks;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a> = durationTicks;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#a5b39f4308b8e715d9278cbf70f7297c7">timerFunc</a> = timerFunc;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">arg</a> = arg;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#ac0c635110dc503f164fff91b163936d7">config</a> = config;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <span class="comment">// 如果初始启动延时为0，则使用周期值</span></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <span class="keywordflow">if</span> (delayTicks == 0) {</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;        timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> = durationTicks;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;        timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> = timer-&gt;<a class="code" href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a>;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    }</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada5a03f072cc3183bc26038b39c73e97e0">tTimerCreated</a>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;}</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;</div><div class="line"><a name="l00056"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7a8932a1c16f4eb96e7a0620272d846e">   56</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7a8932a1c16f4eb96e7a0620272d846e">tTimerStart</a> (<a class="code" href="struct__t_timer.html">tTimer</a> *timer) {</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keywordflow">switch</span> (timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a>) {</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada5a03f072cc3183bc26038b39c73e97e0">tTimerCreated</a>:</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada8217513833783cfb2f446069d0bd5b56">tTimerStopped</a>:</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> = timer-&gt;<a class="code" href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a> ? timer-&gt;<a class="code" href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a> : timer-&gt;<a class="code" href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a>;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adaaf291cc8af972564c57c775a65c70fb5">tTimerStarted</a>;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            <span class="comment">// 根据定时器类型加入相应的定时器列表</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;            <span class="keywordflow">if</span> (timer-&gt;<a class="code" href="struct__t_timer.html#ac0c635110dc503f164fff91b163936d7">config</a> &amp; <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gadde5594113d4922dd2c044b7033e979c">TIMER_CONFIG_TYPE_HARD</a>) {</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;                <span class="comment">// 硬定时器，在时钟节拍中断中处理，所以使用critical来防护</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                uint32_t status = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a>();</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;                <span class="comment">// 加入硬定时器列表</span></div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;                <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga6278d548e9b37d514acbebc25617f1b6">tListAddLast</a>(&amp;tTimerHardList, &amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;                <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a>(status);</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;                <span class="comment">// 软定时器，先获取信号量。以处理此时定时器任务此时同时在访问软定时器列表导致的冲突问题</span></div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;                <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga9946734436c2a1ab849654a72e0de0ce">tSemWait</a>(&amp;tTimerProtectSem, 0);</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;                <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga6278d548e9b37d514acbebc25617f1b6">tListAddLast</a>(&amp;tTimerSoftList, &amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;                <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga7222219d3c608a5f9b941e17b1872731">tSemNotify</a>(&amp;tTimerProtectSem);</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;            }</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            <span class="keywordflow">break</span>;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;        <span class="keywordflow">default</span>:</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            <span class="keywordflow">break</span>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    }</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;}</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7090133d856e1d8bfa5d619e7be397cb">   88</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7090133d856e1d8bfa5d619e7be397cb">tTimerStop</a> (<a class="code" href="struct__t_timer.html">tTimer</a> *timer) {</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">switch</span> (timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a>) {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adaaf291cc8af972564c57c775a65c70fb5">tTimerStarted</a>:</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        <span class="keywordflow">case</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adabcc4ae59c2a81df941ffa3b3e367e95d">tTimerRunning</a>:</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;            <span class="comment">// 如果已经启动，判断定时器类型，然后从相应的延时列表中移除</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            <span class="keywordflow">if</span> (timer-&gt;<a class="code" href="struct__t_timer.html#ac0c635110dc503f164fff91b163936d7">config</a> &amp; <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gadde5594113d4922dd2c044b7033e979c">TIMER_CONFIG_TYPE_HARD</a>) {</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;                <span class="comment">// 硬定时器，在时钟节拍中断中处理，所以使用critical来防护</span></div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;                uint32_t status = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a>();</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                <span class="comment">// 从硬定时器列表中移除</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;                <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga58e2fef327c5254062441ec2f8a101a6">tListRemove</a>(&amp;tTimerHardList, &amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a>(status);</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                <span class="comment">// 软定时器，先获取信号量。以处理此时定时器任务此时同时在访问软定时器列表导致的冲突问题</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;                <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga9946734436c2a1ab849654a72e0de0ce">tSemWait</a>(&amp;tTimerProtectSem, 0);</div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;                <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga58e2fef327c5254062441ec2f8a101a6">tListRemove</a>(&amp;tTimerSoftList, &amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;                <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga7222219d3c608a5f9b941e17b1872731">tSemNotify</a>(&amp;tTimerProtectSem);</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            }</div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada8217513833783cfb2f446069d0bd5b56">tTimerStopped</a>;</div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;            <span class="keywordflow">break</span>;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        <span class="keywordflow">default</span>:</div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;            <span class="keywordflow">break</span>;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    }</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;}</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga34c554ef3abd95f382165dae86122aef">  118</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga34c554ef3abd95f382165dae86122aef">tTimerDestroy</a> (<a class="code" href="struct__t_timer.html">tTimer</a> *timer) {</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7090133d856e1d8bfa5d619e7be397cb">tTimerStop</a>(timer);</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada7c596d0db238155989a07e7f88a6182e">tTimerDestroyed</a>;</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;}</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gade22d847f45a6140702a67ace6b34978">  128</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gade22d847f45a6140702a67ace6b34978">tTimerGetInfo</a> (<a class="code" href="struct__t_timer.html">tTimer</a> *timer, <a class="code" href="struct__t_timer_info.html">tTimerInfo</a> *info) {</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    uint32_t status = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a>();</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a> = timer-&gt;<a class="code" href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">startDelayTicks</a>;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a> = timer-&gt;<a class="code" href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a>;</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#a5b39f4308b8e715d9278cbf70f7297c7">timerFunc</a> = timer-&gt;<a class="code" href="struct__t_timer.html#a5b39f4308b8e715d9278cbf70f7297c7">timerFunc</a>;</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">arg</a> = timer-&gt;<a class="code" href="struct__t_timer.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">arg</a>;</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#ac0c635110dc503f164fff91b163936d7">config</a> = timer-&gt;<a class="code" href="struct__t_timer.html#ac0c635110dc503f164fff91b163936d7">config</a>;</div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    info-&gt;<a class="code" href="struct__t_timer_info.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a>;</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a>(status);</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;}</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> tTimerCallFuncList (<a class="code" href="struct__t_list.html">tList</a> *timerList) {</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <a class="code" href="struct__t_node.html">tNode</a> *node;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="comment">// 检查所有任务的delayTicks数，如果不0的话，减1。</span></div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="keywordflow">for</span> (node = timerList-&gt;<a class="code" href="struct__t_list.html#a6e52b98a705384bda92a389d838065b3">headNode</a>.<a class="code" href="struct__t_node.html#a69448376e4bffe728c05e9279a7d94d6">nextNode</a>; node != &amp;(timerList-&gt;<a class="code" href="struct__t_list.html#a6e52b98a705384bda92a389d838065b3">headNode</a>); node = node-&gt;<a class="code" href="struct__t_node.html#a69448376e4bffe728c05e9279a7d94d6">nextNode</a>) {</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;        <a class="code" href="struct__t_timer.html">tTimer</a> *timer = <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga5a79804168bfcc4553dcf0a57d22724d">tNodeParent</a>(node, <a class="code" href="struct__t_timer.html">tTimer</a>, linkNode);</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;        <span class="comment">// 如果延时已到，则调用定时器处理函数</span></div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        <span class="keywordflow">if</span> ((timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> == 0) || (--timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> == 0)) {</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;            <span class="comment">// 切换为正在运行状态</span></div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adabcc4ae59c2a81df941ffa3b3e367e95d">tTimerRunning</a>;</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;            <span class="comment">// 调用定时器处理函数</span></div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a5b39f4308b8e715d9278cbf70f7297c7">timerFunc</a>(timer-&gt;<a class="code" href="struct__t_timer.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">arg</a>);</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;            <span class="comment">// 切换为已经启动状态</span></div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;            timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adaaf291cc8af972564c57c775a65c70fb5">tTimerStarted</a>;</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;            <span class="keywordflow">if</span> (timer-&gt;<a class="code" href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a> &gt; 0) {</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;                <span class="comment">// 如果是周期性的，则重复延时计数值</span></div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;                timer-&gt;<a class="code" href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">delayTicks</a> = timer-&gt;<a class="code" href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">durationTicks</a>;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;            } <span class="keywordflow">else</span> {</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;                <span class="comment">// 否则，是一次性计数器，中止定时器</span></div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;                <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga58e2fef327c5254062441ec2f8a101a6">tListRemove</a>(timerList, &amp;timer-&gt;<a class="code" href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">linkNode</a>);</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;                timer-&gt;<a class="code" href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">state</a> = <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada8217513833783cfb2f446069d0bd5b56">tTimerStopped</a>;</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            }</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        }</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    }</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;}</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;<span class="keyword">static</span> <a class="code" href="struct__t_task.html">tTask</a> tTimeTask;</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="keyword">static</span> <a class="code" href="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86.html#gad85a7244ee07814c23914d3cfcc91412">tTaskStack</a> tTimerTaskStack[TINYOS_TIMERTASK_STACK_SIZE];</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> tTimerSoftTask (<span class="keywordtype">void</span> *param) {</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">for</span> (;;) {</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;        <span class="comment">// 等待系统节拍发送的中断事件信号</span></div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;        <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga9946734436c2a1ab849654a72e0de0ce">tSemWait</a>(&amp;tTimerTickSem, 0);</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;        <span class="comment">// 获取软定时器列表的访问权限</span></div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;        <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga9946734436c2a1ab849654a72e0de0ce">tSemWait</a>(&amp;tTimerProtectSem, 0);</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;        <span class="comment">// 处理软定时器列表</span></div><div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160;        tTimerCallFuncList(&amp;tTimerSoftList);</div><div class="line"><a name="l00190"></a><span class="lineno">  190</span>&#160;</div><div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;        <span class="comment">// 释放定时器列表访问权限</span></div><div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;        <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga7222219d3c608a5f9b941e17b1872731">tSemNotify</a>(&amp;tTimerProtectSem);</div><div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160;    }</div><div class="line"><a name="l00194"></a><span class="lineno">  194</span>&#160;}</div><div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;</div><div class="line"><a name="l00199"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gae4ae5ad72b29fa9cfcf5444de2d3be63">  199</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gae4ae5ad72b29fa9cfcf5444de2d3be63">tTimerModuleTickNotify</a> (<span class="keywordtype">void</span>) {</div><div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    uint32_t status = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a>();</div><div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    <span class="comment">// 处理硬定时器列表</span></div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    tTimerCallFuncList(&amp;tTimerHardList);</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;</div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a>(status);</div><div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;</div><div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;    <span class="comment">// 通知软定时器节拍变化</span></div><div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga7222219d3c608a5f9b941e17b1872731">tSemNotify</a>(&amp;tTimerTickSem);</div><div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;}</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;</div><div class="line"><a name="l00214"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga62301aa36a38ff645bdf05136b3fd6cf">  214</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga62301aa36a38ff645bdf05136b3fd6cf">tTimerModuleInit</a> (<span class="keywordtype">void</span>) {</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;    <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#gab4cbecbc9ce397733c027de83ce17f81">tListInit</a>(&amp;tTimerHardList);</div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;    <a class="code" href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#gab4cbecbc9ce397733c027de83ce17f81">tListInit</a>(&amp;tTimerSoftList);</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga1a48fab4ce73fc72b1a2ed6fa8771f8e">tSemInit</a>(&amp;tTimerProtectSem, 1, 1);</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    <a class="code" href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga1a48fab4ce73fc72b1a2ed6fa8771f8e">tSemInit</a>(&amp;tTimerTickSem, 0, 0);</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;}</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div><div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga6013a8ecf7fc98794f130d4bfb5f6402">  224</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga6013a8ecf7fc98794f130d4bfb5f6402">tTimerInitTask</a> (<span class="keywordtype">void</span>) {</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;<span class="preprocessor">#if TINYOS_TIMERTASK_PRIO &gt;= (TINYOS_PRO_COUNT - 1)</span></div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;<span class="preprocessor">#error &quot;The proprity of timer task must be greater then (TINYOS_PRO_COUNT - 1)&quot;</span></div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    <a class="code" href="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86.html#ga639ee038febea3c977d37585fcc8a573">tTaskInit</a>(&amp;tTimeTask, tTimerSoftTask, (<span class="keywordtype">void</span> *) 0,</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;              TINYOS_TIMERTASK_PRIO, tTimerTaskStack, <span class="keyword">sizeof</span>(tTimerTaskStack));</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;}</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;</div><div class="ttc" id="struct__t_timer_html_a9ce2ec4812a92cb6ab39f6e81e9173a9"><div class="ttname"><a href="struct__t_timer.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">_tTimer::arg</a></div><div class="ttdeci">void * arg</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00041">tTimer.h:41</a></div></div>
<div class="ttc" id="struct__t_timer_html_acecf013811265c398517a464e7e6f7b2"><div class="ttname"><a href="struct__t_timer.html#acecf013811265c398517a464e7e6f7b2">_tTimer::startDelayTicks</a></div><div class="ttdeci">uint32_t startDelayTicks</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00036">tTimer.h:36</a></div></div>
<div class="ttc" id="struct__t_timer_html_ac0c635110dc503f164fff91b163936d7"><div class="ttname"><a href="struct__t_timer.html#ac0c635110dc503f164fff91b163936d7">_tTimer::config</a></div><div class="ttdeci">uint32_t config</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00043">tTimer.h:43</a></div></div>
<div class="ttc" id="struct__t_sem_html"><div class="ttname"><a href="struct__t_sem.html">_tSem</a></div><div class="ttdef"><b>Definition:</b> <a href="t_sem_8h_source.html#l00024">tSem.h:24</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gga5ae483b48ef1e10020eba42be4deb2adaaf291cc8af972564c57c775a65c70fb5"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adaaf291cc8af972564c57c775a65c70fb5">tTimerStarted</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00026">tTimer.h:26</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga34c554ef3abd95f382165dae86122aef"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga34c554ef3abd95f382165dae86122aef">tTimerDestroy</a></div><div class="ttdeci">void tTimerDestroy(tTimer *timer)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00118">tTimer.c:118</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_acecf013811265c398517a464e7e6f7b2"><div class="ttname"><a href="struct__t_timer_info.html#acecf013811265c398517a464e7e6f7b2">_tTimerInfo::startDelayTicks</a></div><div class="ttdeci">uint32_t startDelayTicks</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00049">tTimer.h:49</a></div></div>
<div class="ttc" id="struct__t_timer_info_html"><div class="ttname"><a href="struct__t_timer_info.html">_tTimerInfo</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00048">tTimer.h:48</a></div></div>
<div class="ttc" id="struct__t_task_html"><div class="ttname"><a href="struct__t_task.html">_tTask</a></div><div class="ttdef"><b>Definition:</b> <a href="t_task_8h_source.html#l00031">tTask.h:31</a></div></div>
<div class="ttc" id="struct__t_timer_html_a95f8cbd7a4ba89fc9ae542eb04a24bc0"><div class="ttname"><a href="struct__t_timer.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">_tTimer::durationTicks</a></div><div class="ttdeci">uint32_t durationTicks</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00037">tTimer.h:37</a></div></div>
<div class="ttc" id="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86_html_gad85a7244ee07814c23914d3cfcc91412"><div class="ttname"><a href="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86.html#gad85a7244ee07814c23914d3cfcc91412">tTaskStack</a></div><div class="ttdeci">uint32_t tTaskStack</div><div class="ttdef"><b>Definition:</b> <a href="t_task_8h_source.html#l00025">tTask.h:25</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_a9ce2ec4812a92cb6ab39f6e81e9173a9"><div class="ttname"><a href="struct__t_timer_info.html#a9ce2ec4812a92cb6ab39f6e81e9173a9">_tTimerInfo::arg</a></div><div class="ttdeci">void * arg</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00053">tTimer.h:53</a></div></div>
<div class="ttc" id="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8_html_ga58e2fef327c5254062441ec2f8a101a6"><div class="ttname"><a href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga58e2fef327c5254062441ec2f8a101a6">tListRemove</a></div><div class="ttdeci">void tListRemove(tList *list, tNode *node)</div><div class="ttdef"><b>Definition:</b> <a href="t_list_8c_source.html#l00200">tList.c:200</a></div></div>
<div class="ttc" id="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga1a48fab4ce73fc72b1a2ed6fa8771f8e"><div class="ttname"><a href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga1a48fab4ce73fc72b1a2ed6fa8771f8e">tSemInit</a></div><div class="ttdeci">void tSemInit(tSem *sem, uint32_t startCount, uint32_t maxCount)</div><div class="ttdef"><b>Definition:</b> <a href="t_sem_8c_source.html#l00024">tSem.c:24</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gab4d6c802c474b9071f48312bed3dec74"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a></div><div class="ttdeci">tTaskCritical_t tTaskEnterCritical(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00036">tSwitch.c:36</a></div></div>
<div class="ttc" id="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8_html_ga5a79804168bfcc4553dcf0a57d22724d"><div class="ttname"><a href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga5a79804168bfcc4553dcf0a57d22724d">tNodeParent</a></div><div class="ttdeci">#define tNodeParent(node, parent, name)</div><div class="ttdef"><b>Definition:</b> <a href="t_lib_8h_source.html#l00048">tLib.h:48</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga7a8932a1c16f4eb96e7a0620272d846e"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7a8932a1c16f4eb96e7a0620272d846e">tTimerStart</a></div><div class="ttdeci">void tTimerStart(tTimer *timer)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00056">tTimer.c:56</a></div></div>
<div class="ttc" id="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8_html_gae1557d8978ed3d8374e2ab3f0920c860"><div class="ttname"><a href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#gae1557d8978ed3d8374e2ab3f0920c860">tNodeInit</a></div><div class="ttdeci">void tNodeInit(tNode *node)</div><div class="ttdef"><b>Definition:</b> <a href="t_list_8c_source.html#l00019">tList.c:19</a></div></div>
<div class="ttc" id="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga9946734436c2a1ab849654a72e0de0ce"><div class="ttname"><a href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga9946734436c2a1ab849654a72e0de0ce">tSemWait</a></div><div class="ttdeci">uint32_t tSemWait(tSem *sem, uint32_t waitTicks)</div><div class="ttdef"><b>Definition:</b> <a href="t_sem_8c_source.html#l00041">tSem.c:41</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_a5b39f4308b8e715d9278cbf70f7297c7"><div class="ttname"><a href="struct__t_timer_info.html#a5b39f4308b8e715d9278cbf70f7297c7">_tTimerInfo::timerFunc</a></div><div class="ttdeci">void(* timerFunc)(void *arg)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00052">tTimer.h:52</a></div></div>
<div class="ttc" id="struct__t_node_html"><div class="ttname"><a href="struct__t_node.html">_tNode</a></div><div class="ttdef"><b>Definition:</b> <a href="t_lib_8h_source.html#l00035">tLib.h:35</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_a1554a5dc790e401b90c319aad88f51dc"><div class="ttname"><a href="struct__t_timer_info.html#a1554a5dc790e401b90c319aad88f51dc">_tTimerInfo::state</a></div><div class="ttdeci">tTimerState state</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00056">tTimer.h:56</a></div></div>
<div class="ttc" id="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86_html_ga639ee038febea3c977d37585fcc8a573"><div class="ttname"><a href="group___xE4_xBB_xBB_xE5_x8A_xA1_xE7_xAE_xA1_xE7_x90_x86.html#ga639ee038febea3c977d37585fcc8a573">tTaskInit</a></div><div class="ttdeci">void tTaskInit(tTask *task, void(*entry)(void *), void *param, uint32_t prio, uint32_t *stack, uint32_t size)</div><div class="ttdef"><b>Definition:</b> <a href="t_task_8c_source.html#l00023">tTask.c:23</a></div></div>
<div class="ttc" id="tiny_o_s_8h_html"><div class="ttname"><a href="tiny_o_s_8h.html">tinyOS.h</a></div></div>
<div class="ttc" id="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8_html_ga6278d548e9b37d514acbebc25617f1b6"><div class="ttname"><a href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#ga6278d548e9b37d514acbebc25617f1b6">tListAddLast</a></div><div class="ttdeci">void tListAddLast(tList *list, tNode *node)</div><div class="ttdef"><b>Definition:</b> <a href="t_list_8c_source.html#l00148">tList.c:148</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga62301aa36a38ff645bdf05136b3fd6cf"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga62301aa36a38ff645bdf05136b3fd6cf">tTimerModuleInit</a></div><div class="ttdeci">void tTimerModuleInit(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00214">tTimer.c:214</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_ac0c635110dc503f164fff91b163936d7"><div class="ttname"><a href="struct__t_timer_info.html#ac0c635110dc503f164fff91b163936d7">_tTimerInfo::config</a></div><div class="ttdeci">uint32_t config</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00055">tTimer.h:55</a></div></div>
<div class="ttc" id="struct__t_timer_html_ab9a5b93b6f7bf200c776df8731d99133"><div class="ttname"><a href="struct__t_timer.html#ab9a5b93b6f7bf200c776df8731d99133">_tTimer::linkNode</a></div><div class="ttdeci">tNode linkNode</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00034">tTimer.h:34</a></div></div>
<div class="ttc" id="struct__t_timer_info_html_a95f8cbd7a4ba89fc9ae542eb04a24bc0"><div class="ttname"><a href="struct__t_timer_info.html#a95f8cbd7a4ba89fc9ae542eb04a24bc0">_tTimerInfo::durationTicks</a></div><div class="ttdeci">uint32_t durationTicks</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00050">tTimer.h:50</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga6013a8ecf7fc98794f130d4bfb5f6402"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga6013a8ecf7fc98794f130d4bfb5f6402">tTimerInitTask</a></div><div class="ttdeci">void tTimerInitTask(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00224">tTimer.c:224</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gae4ae5ad72b29fa9cfcf5444de2d3be63"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gae4ae5ad72b29fa9cfcf5444de2d3be63">tTimerModuleTickNotify</a></div><div class="ttdeci">void tTimerModuleTickNotify(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00199">tTimer.c:199</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga21b4efbc4cb710d7d0e71678d2b13e53"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a></div><div class="ttdeci">void tTaskExitCritical(tTaskCritical_t status)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00047">tSwitch.c:47</a></div></div>
<div class="ttc" id="struct__t_timer_html_a1554a5dc790e401b90c319aad88f51dc"><div class="ttname"><a href="struct__t_timer.html#a1554a5dc790e401b90c319aad88f51dc">_tTimer::state</a></div><div class="ttdeci">tTimerState state</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00044">tTimer.h:44</a></div></div>
<div class="ttc" id="struct__t_timer_html_a0c1ef2b42e60232fd2355246df290c68"><div class="ttname"><a href="struct__t_timer.html#a0c1ef2b42e60232fd2355246df290c68">_tTimer::delayTicks</a></div><div class="ttdeci">uint32_t delayTicks</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00038">tTimer.h:38</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga7090133d856e1d8bfa5d619e7be397cb"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga7090133d856e1d8bfa5d619e7be397cb">tTimerStop</a></div><div class="ttdeci">void tTimerStop(tTimer *timer)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00088">tTimer.c:88</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_ga2a6a895916b16bcb9b01ac53cb28e015"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#ga2a6a895916b16bcb9b01ac53cb28e015">tTimerInit</a></div><div class="ttdeci">void tTimerInit(tTimer *timer, uint32_t delayTicks, uint32_t durationTicks, void(*timerFunc)(void *arg), void *arg, uint32_t config)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00034">tTimer.c:34</a></div></div>
<div class="ttc" id="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F_html_ga7222219d3c608a5f9b941e17b1872731"><div class="ttname"><a href="group___xE4_xBF_xA1_xE5_x8F_xB7_xE9_x87_x8F.html#ga7222219d3c608a5f9b941e17b1872731">tSemNotify</a></div><div class="ttdeci">void tSemNotify(tSem *sem)</div><div class="ttdef"><b>Definition:</b> <a href="t_sem_8c_source.html#l00088">tSem.c:88</a></div></div>
<div class="ttc" id="struct__t_node_html_a69448376e4bffe728c05e9279a7d94d6"><div class="ttname"><a href="struct__t_node.html#a69448376e4bffe728c05e9279a7d94d6">_tNode::nextNode</a></div><div class="ttdeci">struct _tNode * nextNode</div><div class="ttdef"><b>Definition:</b> <a href="t_lib_8h_source.html#l00037">tLib.h:37</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gga5ae483b48ef1e10020eba42be4deb2adabcc4ae59c2a81df941ffa3b3e367e95d"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2adabcc4ae59c2a81df941ffa3b3e367e95d">tTimerRunning</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00027">tTimer.h:27</a></div></div>
<div class="ttc" id="t_timer_8h_html"><div class="ttname"><a href="t_timer_8h.html">tTimer.h</a></div></div>
<div class="ttc" id="struct__t_list_html_a6e52b98a705384bda92a389d838065b3"><div class="ttname"><a href="struct__t_list.html#a6e52b98a705384bda92a389d838065b3">_tList::headNode</a></div><div class="ttdeci">tNode headNode</div><div class="ttdef"><b>Definition:</b> <a href="t_lib_8h_source.html#l00044">tLib.h:44</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gga5ae483b48ef1e10020eba42be4deb2ada7c596d0db238155989a07e7f88a6182e"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada7c596d0db238155989a07e7f88a6182e">tTimerDestroyed</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00029">tTimer.h:29</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gga5ae483b48ef1e10020eba42be4deb2ada8217513833783cfb2f446069d0bd5b56"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada8217513833783cfb2f446069d0bd5b56">tTimerStopped</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00028">tTimer.h:28</a></div></div>
<div class="ttc" id="struct__t_timer_html_a5b39f4308b8e715d9278cbf70f7297c7"><div class="ttname"><a href="struct__t_timer.html#a5b39f4308b8e715d9278cbf70f7297c7">_tTimer::timerFunc</a></div><div class="ttdeci">void(* timerFunc)(void *arg)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00040">tTimer.h:40</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gade22d847f45a6140702a67ace6b34978"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gade22d847f45a6140702a67ace6b34978">tTimerGetInfo</a></div><div class="ttdeci">void tTimerGetInfo(tTimer *timer, tTimerInfo *info)</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8c_source.html#l00128">tTimer.c:128</a></div></div>
<div class="ttc" id="struct__t_timer_html"><div class="ttname"><a href="struct__t_timer.html">_tTimer</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00033">tTimer.h:33</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gga5ae483b48ef1e10020eba42be4deb2ada5a03f072cc3183bc26038b39c73e97e0"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gga5ae483b48ef1e10020eba42be4deb2ada5a03f072cc3183bc26038b39c73e97e0">tTimerCreated</a></div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00025">tTimer.h:25</a></div></div>
<div class="ttc" id="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8_html_gadde5594113d4922dd2c044b7033e979c"><div class="ttname"><a href="group___xE8_xBD_xAF_xE5_xAE_x9A_xE6_x97_xB6_xE5_x99_xA8.html#gadde5594113d4922dd2c044b7033e979c">TIMER_CONFIG_TYPE_HARD</a></div><div class="ttdeci">#define TIMER_CONFIG_TYPE_HARD</div><div class="ttdef"><b>Definition:</b> <a href="t_timer_8h_source.html#l00060">tTimer.h:60</a></div></div>
<div class="ttc" id="struct__t_list_html"><div class="ttname"><a href="struct__t_list.html">_tList</a></div><div class="ttdef"><b>Definition:</b> <a href="t_lib_8h_source.html#l00043">tLib.h:43</a></div></div>
<div class="ttc" id="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8_html_gab4cbecbc9ce397733c027de83ce17f81"><div class="ttname"><a href="group___xE5_x8F_x8C_xE5_x90_x91_xE9_x93_xBE_xE8_xA1_xA8.html#gab4cbecbc9ce397733c027de83ce17f81">tListInit</a></div><div class="ttdeci">void tListInit(tList *list)</div><div class="ttdef"><b>Definition:</b> <a href="t_list_8c_source.html#l00032">tList.c:32</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="t_timer_8c.html">tTimer.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
